/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ThreadClient;

import RemoteDesktop.ConnectRemote;
import StaticClass.ArrSocket;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author ThuyHuynh
 */
public class ConnectNameCl extends Thread {

    int port;
    Socket sk = null;

    public ConnectNameCl(int port) {
        this.port = port;
    }  
    @Override
    public void run() {
        try {
            Connection cnn;
             sk = new Socket(ArrSocket.HOSTNAME, port);
             ObjectOutputStream out = new ObjectOutputStream(sk.getOutputStream());
             ObjectInputStream in = new ObjectInputStream(sk.getInputStream());
                    SendComputerName.SendInfor(out, in);
             
            cnn = new Connection(1234);
            cnn.start();
            ConnectFile fcn = new ConnectFile(4567);
            fcn.start();
            ConnectFile_Tree fcnt = new ConnectFile_Tree(4568);
            fcnt.start();
            ConnectImages img = new ConnectImages(4569);
            img.start();
            ConnectShell cns = new ConnectShell(6778);
            cns.start();
            new ConnectRemote(5678).start();
            ThreadMessages tsm = new ThreadMessages(2345);
            Socket soc = tsm.TaoKetNoi();
            tsm.Listen(soc);
        } catch (UnknownHostException ex) {
            Logger.getLogger(Connection.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(Connection.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
